﻿using DevExpress.XtraEditors;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;

namespace UserModule
{
    public partial class FormUserLogoIn : DevExpress.XtraEditors.XtraForm
    {
        public FormUserLogoIn()
        {
            InitializeComponent();
        }

        private void simpleButton确定_Click(object sender, EventArgs e)
        {
            UpdateUserLevel();
            FrameManager.FrameManager.FrmMain.SetUseLevelVisible(UserManager.iUserLevel);
        }
        private void UpdateUserLevel()
        {
            bool bLgoinInOK = UserManager.LogIn(textEditPassWord.Text);
            if (bLgoinInOK)
            {
                Close();
                return;
            }
            else
            {
                XtraMessageBox.Show("登录失败,登录信息错误");
                return;
            }

        }

        private void textEditPassWord_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                UpdateUserLevel();
                FrameManager.FrameManager.FrmMain.SetUseLevelVisible(UserManager.iUserLevel);
            }
        }
    }
}
